#include "qerrorinifile.h"

QErrorIniFile::QErrorIniFile()
  : QSettings(ERR_INI_FILENAME,QSettings::IniFormat)
{
  #ifdef  LOG_ACTIVATED
  __TRACE__
  #endif
  #ifdef  LEAK_ACTIVATED
  __LEAK__
  #endif
  QFileInfo infos(ERR_INI_FILENAME);
  if(!infos.exists())
    createDefault();
}

QErrorIniFile::~QErrorIniFile()
{
  #ifdef  LOG_ACTIVATED
  __TRACE__
  #endif
  #ifdef  LEAK_ACTIVATED
  __LEAK__
  #endif
}


void QErrorIniFile::createDefault()
{
  #ifdef  LOG_ACTIVATED
  __TRACE__
  #endif
  #ifdef  LEAK_ACTIVATED
  __LEAK__
  #endif
  beginGroup(ERR_PLP_MISSING_ID);
  setValue(ERR_TEXT,ERR_PLP_MISSING_TEXT);
  setValue(ERR_ID,ERR_PLP_MISSING_ID);
  setValue(ERR_IMPORTANCE,ERR_PLP_MISSING_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_REF_MANU_MISSING_ID);
  setValue(ERR_TEXT,ERR_REF_MANU_MISSING_TEXT);
  setValue(ERR_ID,ERR_REF_MANU_MISSING_ID);
  setValue(ERR_IMPORTANCE,ERR_REF_MANU_MISSING_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_MANU_MISSING_ID);
  setValue(ERR_TEXT,ERR_MANU_MISSING_TEXT);
  setValue(ERR_ID,ERR_MANU_MISSING_ID);
  setValue(ERR_IMPORTANCE,ERR_MANU_MISSING_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_ORANGE);
  endGroup();

  beginGroup(ERR_FOOTPRINT_MISSING_ID);
  setValue(ERR_TEXT,ERR_FOOTPRINT_MISSING_TEXT);
  setValue(ERR_ID,ERR_FOOTPRINT_MISSING_ID);
  setValue(ERR_IMPORTANCE,ERR_FOOTPRINT_MISSING_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_PLP_NOT_IN_BDD_ID);
  setValue(ERR_TEXT,ERR_PLP_NOT_IN_BDD_TEXT);
  setValue(ERR_ID,ERR_PLP_NOT_IN_BDD_ID);
  setValue(ERR_IMPORTANCE,ERR_PLP_NOT_IN_BDD_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_PLP_NOT_IN_BDD_BUT_EXPORT_ID);
  setValue(ERR_TEXT,ERR_PLP_NOT_IN_BDD_BUT_EXPORT_TEXT);
  setValue(ERR_ID,ERR_PLP_NOT_IN_BDD_BUT_EXPORT_ID);
  setValue(ERR_IMPORTANCE,ERR_PLP_NOT_IN_BDD_BUT_EXPORT_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_SAME_PLP_BUT_NOT_SAME_FOOTPRINT_ID);
  setValue(ERR_TEXT,ERR_SAME_PLP_BUT_NOT_SAME_FOOTPRINT_TEXT);
  setValue(ERR_ID,ERR_SAME_PLP_BUT_NOT_SAME_FOOTPRINT_ID);
  setValue(ERR_IMPORTANCE,ERR_SAME_PLP_BUT_NOT_SAME_FOOTPRINT_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_SAME_PLP_BUT_NOT_SAME_REF_ID);
  setValue(ERR_TEXT,ERR_SAME_PLP_BUT_NOT_SAME_REF_TEXT);
  setValue(ERR_ID,ERR_SAME_PLP_BUT_NOT_SAME_REF_ID);
  setValue(ERR_IMPORTANCE,ERR_SAME_PLP_BUT_NOT_SAME_REF_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_SAME_VALUE_BUT_NOT_SAME_FOOTPRINT_ID);
  setValue(ERR_TEXT,ERR_SAME_VALUE_BUT_NOT_SAME_FOOTPRINT_TEXT);
  setValue(ERR_ID,ERR_SAME_VALUE_BUT_NOT_SAME_FOOTPRINT_ID);
  setValue(ERR_IMPORTANCE,ERR_SAME_VALUE_BUT_NOT_SAME_FOOTPRINT_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_BLUE);
  endGroup();

  beginGroup(ERR_SAME_VALUE_BUT_NOT_SAME_PLP_ID);
  setValue(ERR_TEXT,ERR_SAME_VALUE_BUT_NOT_SAME_PLP_TEXT);
  setValue(ERR_ID,ERR_SAME_VALUE_BUT_NOT_SAME_PLP_ID);
  setValue(ERR_IMPORTANCE,ERR_SAME_VALUE_BUT_NOT_SAME_PLP_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_BLUE);
  endGroup();

  beginGroup(ERR_SAME_REF_MANU_BUT_NOT_SAME_PLP_ID);
  setValue(ERR_TEXT,ERR_SAME_REF_MANU_BUT_NOT_SAME_PLP_TEXT);
  setValue(ERR_ID,ERR_SAME_REF_MANU_BUT_NOT_SAME_PLP_ID);
  setValue(ERR_IMPORTANCE,ERR_SAME_REF_MANU_BUT_NOT_SAME_PLP_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();

  beginGroup(ERR_SAME_REF_MANU_BUT_NOT_SAME_FOOTPRINT_ID);
  setValue(ERR_TEXT,ERR_SAME_REF_MANU_BUT_NOT_SAME_FOOTPRINT_TEXT);
  setValue(ERR_ID,ERR_SAME_REF_MANU_BUT_NOT_SAME_FOOTPRINT_ID);
  setValue(ERR_IMPORTANCE,ERR_SAME_REF_MANU_BUT_NOT_SAME_FOOTPRINT_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();
  
  beginGroup(ERR_SAME_REF_MANU_BUT_NOT_SAME_FOOTPRINT_ID);
  setValue(ERR_TEXT,ERR_NOT_SAME_VALUE_IN_PLP_AND_VALUE);
  setValue(ERR_ID,ERR_NOT_SAME_VALUE_IN_PLP_AND_VALUE_ID);
  setValue(ERR_IMPORTANCE,ERR_NOT_SAME_VALUE_IN_PLP_AND_VALUE_IMPORTANCE);
  setValue(ERR_COLOR,CLR_LIGHT_RED);
  endGroup();
}